﻿
// MyTetrisView.h: CMyTetrisView 类的接口
//

#pragma once


class CMyTetrisView : public CView
{
protected: // 仅从序列化创建
	CMyTetrisView() noexcept;
	DECLARE_DYNCREATE(CMyTetrisView)

// 特性
public:
	CMyTetrisDoc* GetDocument() const;

// 操作
public:

// 重写
public:
	virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// 实现
public:
	virtual ~CMyTetrisView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// 生成的消息映射函数
protected:
	DECLARE_MESSAGE_MAP()
private:
	CPoint m_ptBlockInitial[4];
	CPoint m_ptBlockCopy[4];
	int index;
	COLORREF m_clrBlockInitial;
	void BlockCreate();
	int flag;
	int flag2;
	int cor[10][20];
	void BlockDisplay();
	CPoint dd[4];
	int Y;
	int key;
	COLORREF color[10][20];
	UINT IDC_TIMER;
	int count;
public:
	afx_msg void OnPaint();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
private:
	void MoveToLeft();
	void MoveToRight();
	void MoveToBottom();
public:
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
private:
	void BlockErase();
	int OutOfLeft();
	int OutOfRight();
	int MoveToRotate();
	int ArriveAtBottom();
	void GameOver();
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};

#ifndef _DEBUG  // MyTetrisView.cpp 中的调试版本
inline CMyTetrisDoc* CMyTetrisView::GetDocument() const
   { return reinterpret_cast<CMyTetrisDoc*>(m_pDocument); }
#endif

